import pygame
import sys
import time

# local
from drawClass import Point, Line, Circle, Rect

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
running = True
dt = clock.tick(60) / 1000.0

point = Point(screen, "red", (10, 10))
line = Line(screen, "green", (10, 15), (30, 15))
circle = Circle(screen, "blue", (10, 30), 10)
rect = Rect(screen, "yellow", (10, 45, 30, 20))
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        else:
            print(event)

    # 屏幕填充颜色
    screen.fill("black")

    dt = clock.tick(60) / 10.0
    line.move_right(dt, 0)
    line.draw()

    point.move_right(dt, 0)
    point.draw()

    circle.move_right(dt)
    circle.draw()
    
    rect.move_right(dt)
    rect.draw()

    # 刷新屏幕
    pygame.display.flip()
    clock.tick(60)  # 限制fps 30帧
